The present invention relates to a method for measuring a distance based on a phase-difference detection, which is a basic principle of the auto-focusing apparatus, such as camera.
At first, the conventional principle of measuring a distance will be explained in connection with FIGS. 3 and 4. FIG. 3 is a schematic view for explaining the principle of measuring a distance. FIG. 4 shows a set of image data for explaining the principle of measuring a distance.
Referring now to FIG. 3, an origin O is set at a midpoint between the optical axes of focusing lenses 61 and 62. And, the axis of abscissa X and the axis of ordinate Y are defined as described in FIG. 3. Then, the coordinates of focused image positions L.sub.1 and R.sub.1 on optical sensor arrays 63 and 64 are expressed respectively by (-a.sub.L1 -B/2, -f) and (a.sub.R1 +B/2, -f). Here, a.sub.L1 and a.sub.R1 are distances on the respective sensor arrays 63 and 64, and B is the distance between the optical axes of the focusing lenses 61 and 62.
The coordinate of the center O.sub.L of the focusing lens 61 is expressed by (-B/2, 0), and the coordinate of the center O.sub.R of the focusing lens 62 is expressed by (B/2, 0). If the coordinate of a point M on an object 51 is expressed by (x, y), the coordinate of a cross point N of the vertical line drawn from the point M to the X-axis with the X-axis is expressed by (x, 0). The coordinate of a point L.sub.o of the vertical line drawn from a center O.sub.L of the focusing lens 61 on the optical sensor array 63 is expressed by (-B/2, -f), and the coordinate of a point R.sub.O of the vertical line drawn from a center O.sub.R of the focusing lens 62 on the optical sensor array 64 is expressed by (B/2, -f). Since a triangle MO.sub.L N and a triangle O.sub.L L.sub.1 L.sub.O are similar, and a triangle MO.sub.R N and a triangle O.sub.R L.sub.1 L.sub.O are similar, respectively, the following numerical formulas (1) and (2) are held. EQU (x+B/2)f=a.sub.L1 .multidot.y (1) EQU (-x+B/2)f=a.sub.R1 .multidot.y (2)
The following numerical formula (3) is derived from the numerical formulas (1) and (2).
If the distances a.sub.L1 and a.sub.R1 concerning the positions L.sub.1 and R.sub.1 of the focused images are detected, the distance y between the focusing lens pair and the object 51 can be calculated from the numerical formula (3). EQU y=B.multidot.f/(a.sub.R1 +a.sub.L1) (3)
Now, the operations for detecting the foregoing distance y will be explained in detail with reference to FIG. 4.
Data 63L and 64R, represented by the solid curves in FIG. 4, of the left and right images are compared in a specific distance measuring range. If the compared image data is not identical to each other, the image data 63L of the left image is shifted to the right and the image data 64R of the right image is shifted to the left as described by the broken curves in FIG. 4 until the shift length (a.sub.R1 +a.sub.L1), at which the data of the left image and the data of the right image almost coincide with each other, is detected.
The left and right image data 63L and 64R do not always coincide perfectly with each other, since the point at which the left and right image data 63L and 64R coincide with each other may be located in the gap between the picture elements of the optical sensor array 63 or 64.
The distance y between the object 51 and the focusing lens pair is calculated by the numerical formula (3) using the detected shift length (a.sub.R1 +a.sub.L1).
For detecting the degree of coincidence of the left image data 63L and the right image data 64R, a specific range (window) is set on the data 63L and the data 64R.
Then, a first image data 71 and a second image data 72 are compared in the specific range as described in FIG. 5, and the area of the portions on which the first data 71 and the second data 72 do not overlap with each other (hatched areas in FIG. 5) is obtained.
Generally, this area is called an "evaluation function". The evaluation function is calculated for every specific range, in which the range of the image data (first image data or second image data) is shifted for one picture element length, i.e. one pitch of the picture elements constituting the optical sensor array.
In phase difference detection, it is judged that the same images are projected onto a specific range where the value of the evaluation function is minimum and least.
And, the distance of the object is calculated by finding an exact shift length (a.sub.R1 +a.sub.L1) using the minimum and least value of the evaluation function and the values of the evaluation functions in two or three specific ranges adjacent to the specific range where the value of the evaluation function is the minimum and least.
When the contrast of the object is low or there exists unbalance of the light quantities between the first sensor array and the second sensor array (light quantity difference), the values of the evaluation function in the ranges adjacent to the specific rage where the value of the evaluation function is the minimum and least, become small.
Therefore, according to the conventional techniques, it is estimated that the contrast of the object is low and that the calculated distance data is not so reliable when the values of the evaluation function in the adjacent specific ranges are less than a certain reference value.
However, it is not enough to inspect the reliability of the calculated distance data based on the values of the evaluation function in the specific ranges adjacent to the specific range where the value of the evaluation function is the minimum and least. It has been found that, in some cases, that the reliability of the calculated distance data is low even when values of the evaluation function are large.
In view of the foregoing, it is an object of the invention to provide a method for measuring a distance which facilitates inspecting the reliability of the calculated distance data with high accuracy all the time when the values of the evaluation function in the specific ranges, adjacent to the specific range where the evaluation function takes the minimum and least value, are large.